<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/in.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
<title>管理员日志管理</title>

<!-- Bootstrap -->
<link
	href="${staticPage}/script/bootstrap/bootstrap-3.3.5-dist/css/bootstrap.min.css"
	rel="stylesheet">
<link href="${staticPage}/css/admin/admin.css" rel="stylesheet">
<link rel='icon' href='${staticPage}/image/title_logo.ico'
	type='image/x-ico' />
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script type="text/javascript"
	src="${staticPage}/script/bootstrap/bootstrap-3.3.5-dist/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script type="text/javascript" src="${staticPage}/script/bootstrap/bootstrap-3.3.5-dist/js/html5shiv.js"></script>
<script type="text/javascript" src="${staticPage}/script/bootstrap/bootstrap-3.3.5-dist/js/respond.js"></script>
 <![endif]-->
<script src="${staticPage}/script/laydate-master/laydate.dev.js"></script>
<script type="text/javascript">
	function showLocale(objD) {
		var str, colorhead, colorfoot;
		var yy = objD.getYear();
		if (yy < 1900)
			yy = yy + 1900;
		var MM = objD.getMonth() + 1;
		if (MM < 10)
			MM = '0' + MM;
		var dd = objD.getDate();
		if (dd < 10)
			dd = '0' + dd;
		var hh = objD.getHours();
		if (hh < 10)
			hh = '0' + hh;
		var mm = objD.getMinutes();
		if (mm < 10)
			mm = '0' + mm;
		var ss = objD.getSeconds();
		if (ss < 10)
			ss = '0' + ss;
		var ww = objD.getDay();
		if (ww == 0)
			colorhead = "<font color=\"#02c69e\">";
		if (ww > 0 && ww < 6)
			colorhead = "<font color=\"#02c69e\">";
		if (ww == 6)
			colorhead = "<font color=\"#02c69e\">";
		if (ww == 0)
			ww = "星期日";
		if (ww == 1)
			ww = "星期一";
		if (ww == 2)
			ww = "星期二";
		if (ww == 3)
			ww = "星期三";
		if (ww == 4)
			ww = "星期四";
		if (ww == 5)
			ww = "星期五";
		if (ww == 6)
			ww = "星期六";
		colorfoot = "</font>"
		str = colorhead + yy + "年" + MM + "月" + dd + "日" + " " + ww + colorfoot;
		return (str);
	}
	function tick() {
		var today;
		today = new Date();
		document.getElementById("current_time").innerHTML = showLocale(today);
		window.setTimeout("tick()", 1000);
	}
	function queryOutStorageResult(startPage, pageSize) {
		$(".td_data").remove();
		$(".pagination").html("");
		$
				.getJSON(
						"${ctx}/log_list.json",
						{
							start : startPage,
							limit : pageSize
						},
						function(json) {
							if (json.list.length > 0) {
								var tem = json.totalSize;
								var prePage = (startPage == null || startPage < 2) ? 1
										: startPage - 1;
								var nextPage = (startPage == null || startPage < 2) ? 2
										: startPage + 1;
								if (nextPage > tem)
									nextPage = tem;
								//加分页条
								$(".pagination")
										.append(
												"<li><a onclick=\"queryOutStorageResult("
														+ prePage
														+ ")\" aria-label=\"Previous\"> <span "
					+"aria-hidden=\"true\">&laquo;</span></a></li>");
								var i = 0;
								while (tem - i > 0) {
									$(".pagination").append(
											"<li><a onclick=\"queryOutStorageResult("
													+ (++i) + ")\" >" + i
													+ "</a></li>");
								}
								$(".pagination")
										.append(
												"<li><a onclick=\"queryOutStorageResult("
														+ nextPage
														+ ")\" aria-label=\"Next\"> <span "
					+"aria-hidden=\"true\">&raquo;</span></a></li>");
								$(".pagination a").each(function(i){
									var page = $(this).html();
									if(startPage == i){
										$(this).attr("style","background-color:#dddddd;");
										$(this).addClass("pagecolor");
									}
								});

								//加数据
								$
										.each(
												json.list,
												function(i, item) {
													$("#log_table")
															.append(
																	"<tr class='td_data'><td>"
																			+ item.ip
																			+ "</td><td>"
																			+ item.content
																			+ "</td><td>"
																			+ formatTime(item.submitDate)
																			+ "</td></tr>");
												});
							}
						});
	}
	$(function() {
		tick();
		queryOutStorageResult();
	});
	
    /* laydate({
        istime: true,
        elem: '#begin_time',
        elem:'#end_time',
        event: 'focus'
    });  */
</script>
</head>

<body>
	<div class="container-fluid">
		<div class="row"
			style="padding: 10px; box-shadow: 0 5px 15px #999999;">
			<div class="col-md-offset-1 col-md-2">
				<img src="${staticPage}/images/logo.png" width="200" height="49"
					alt="Logo" />
			</div>
			<div class="col-md-2">
				<span class="logoStyle">权证管理系统</span>
			</div>
			<div class="col-md-2">
				<div id="current_time" class="navStyle"></div>
			</div>
			<!-- 			<div class="col-md-1">
				<div class="navStyle">职位</div>
			</div> -->
			<div class="col-md-2">
				<a class="navStyle" href="${ctx}/password_management.do">账号(${current_user.loginName})</a>
			</div>
			<div class="col-md-2">
				<a href="${ctx}/user_logout.do" class="navExit"><span
					class="glyphicon glyphicon-import" aria-hidden="true"></span>退出</a>
			</div>
		</div>
		<div class="row">
			<div class="clearfix visible-xs-block"></div>

			<div class="col-md-offset-1 col-md-4">
				<span class="Ulocation">您的当前位置：</span>
				<ol class="breadcrumb"
					style="background-color: #ffffff; margin-top: 15px;">
					<li class="active"><a href="${ctx}/admin_record.do">日志管理</a></li>
				</ol>
			</div>

		</div>
		<div class="row">
			<div class="col-md-offset-1 col-md-2">
				<!--侧边栏和主内容在同一个row内,侧边栏左侧和主内容右侧各留有一个col的距离-->

				<div class="panel-group" id="accordion" style="margin-left: 12px">
					<div class="panel panel-default">
						<div class="panel-heading" style="background-color: #02c69e">
							<h4 class="panel-title">
								<a href="${ctx}/admin_user.do" data-parent="#accordion"
									style="background-color: #02c69e"> 用户管理 </a>
							</h4>
						</div>
					</div>
					<%-- 
					<div class="panel panel-default">
						<div class="panel-heading" style="background-color: #02c69e">
							<h4 class="panel-title">
								<a href="${ctx}/admin_role.do" data-parent="#accordion"
									style="background-color: #02c69e">角色管理 </a>
							</h4>
						</div>
					</div>
					 --%>
					<div class="panel panel-default">
						<div class="panel-heading" style="background-color: #02c69e">
							<h4 class="panel-title">
								<a data-toggle="collapse" data-parent="#accordion"
									href="#collapseOne">字典管理</a>
							</h4>
						</div>
						<div id="collapseOne" class="panel-collapse collapse">
							<div class="panel-body" style="padding: 0; line-height: 10px">
								<div class="list-group" style="margin-bottom: 0;">
									<a href="${ctx}/admin_dictionary.do" class="list-group-item"
										style="border-top-left-radius: 0; border-top-right-radius: 0; border: 0">网点管理</a>
									<%-- <a href="${ctx}/am_car_registration.do" class="list-group-item"
										style="border-bottom-left-radius: 0; border-bottom-right-radius: 0;">机动车登记证</a> --%>
								</div>
							</div>
						</div>
					</div>

					<div class="panel panel-default">
						<div class="panel-heading" style="background-color: #02c69e">
							<h4 class="panel-title">
								<a href="${ctx}/admin_record.do" data-parent="#accordion"
									style="background-color: #02c69e"> 日志管理 </a>
							</h4>
						</div>
					</div>

				</div>
			</div>
			<div class="col-md-8" style="">
				<!--侧边栏和主内容在同一个row内-->
				<div class="boderbox">
					<div class="row">
						<div class="container-fluid">
							<div class="col-md-1" style="padding: 0;">操作人:</div>
							<div class="col-md-3">
								<input style="margin: -9px 0 5px" type="text"
									class="form-control" placeholder="请输入操作人">
							</div>
							<div class="col-md-2">操作关键字:</div>
							<div class="col-md-3">
								<input style="margin: -9px 0 5px" type="text"
									class="form-control" placeholder="请输入操作关键字">
							</div>
						</div>
					</div>
					<hr style="margin-top: 0" />
					<div class="row">
						<div class="container-fluid">
							<div class="col-md-1" style="padding: 0;">开始时间:</div>
							<div class="col-md-3">
								<input style="margin: -9px 0 5px" type="text"
									class="form-control" placeholder="请选择开始日期" id="begin_time"
									onclick="laydate()" />
							</div>
							<div class="col-md-2">结束时间:</div>
							<div class="col-md-3">
								<input style="margin: -9px 0 5px" type="text"
									class="form-control" placeholder="请选择结束日期" id="end_time"
									onclick="laydate()" />
							</div>
							<div class="col-md-offset-1 col-md-1">
								<button class="btn btn-default glyphicon glyphicon-search"
									style="margin: -9px 0 5px; background-color: #02c69e;">搜索
								</button>
							</div>
						</div>
					</div>
					<!-- 请输入关键字，搜索-->
					<hr style="margin-top: 0" />

					<div id="myTabContent" class="tab-content  scrollbar">
						<!--内联显示的框架，含滚动条-->
						<table class="table table-bordered" style="" id="log_table">
							<tr>
								<th style="text-align: center;">IP地址</th>
								<th style="text-align: center;">操作内容</th>
								<th style="text-align: center;">操作时间</th>
							</tr>
						</table>
					</div>
					<!--主内容，row中占了8个col，侧边栏占了2个-->
				</div>
				<div class="row" align="middle">
					<nav>
						<ul class="pagination">
						</ul>
					</nav>
				</div>
				<!--row包含 主内容和侧边栏-->
			</div>
</body>
</html>